UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '86eYzALIdXv56tdU3Q6N2AHWF9PWf70uGoIFon4r8oc='
WHERE
key_id = 'b229e2a57c6a990756559385737bfd0e3cd0173df06b493ab1d9222e8a652033'
AND (
token = '86eYzALIdXv56tdU3Q6N2AHWF9PWf70uGoIFon4r8oc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)