UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0YKEC3WLCPa0fhzhWpiK3x2qRZBtivzphG8tDzjdO9c='
WHERE
key_id = 'b4931598b8c2d8a142691a0e0ad9ed1fb5906ca772dc577e8a70db635604ba5e'
AND (
token = '0YKEC3WLCPa0fhzhWpiK3x2qRZBtivzphG8tDzjdO9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)