UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gy8rjvAxNSXUnqa8bmPfoMLpVTMNVCoRFAeRDFQ/duo='
WHERE
key_id = 'b97ff07fc0c59e22a0cdce49844ad3705991483957805e17e278a4330783a8b7'
AND (
token = 'gy8rjvAxNSXUnqa8bmPfoMLpVTMNVCoRFAeRDFQ/duo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)