UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I7z38cqANvsg9r7CAzaRZyT88e7esABjSpOLwEMmFpI='
WHERE
key_id = '8035c6eb0bb8c4e5fbe51e6551d1ca2d3d0d94d1c71e8e4a96a494a2acda4562'
AND (
token = 'I7z38cqANvsg9r7CAzaRZyT88e7esABjSpOLwEMmFpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)