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