UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KEi54nBCbtWxlkcVOBp9NmxVtGBITuZzHlUCTBKK6oQ='
WHERE
key_id = '17446ab6983af86787e7d0286967854ad9d311a9f02227c9f82a7e8aebe122a5'
AND (
token = 'KEi54nBCbtWxlkcVOBp9NmxVtGBITuZzHlUCTBKK6oQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)