UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w5w0j8VJBNVcV79s08Co7tte26z9T65VRrwYWFx2BKk='
WHERE
key_id = 'ac5231df04d10ffe2f47fd502e6dc434c9c6ab59b7b7de9e2b99843cba3c781a'
AND (
token = 'w5w0j8VJBNVcV79s08Co7tte26z9T65VRrwYWFx2BKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)