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