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