UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g8gnvjHTceibc0jyb8MpJ9Y+a5VfOrqaDtzMvATEKp8='
WHERE
key_id = '8824364394b26a726338b6f24ca0a8671f5b4d7c2ccfe8cc9e4a3bf148bb48e2'
AND (
token = 'g8gnvjHTceibc0jyb8MpJ9Y+a5VfOrqaDtzMvATEKp8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)