UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tsie1MiI9kHvmTh1+tV8eMZjslIVYZ4CgNWrmcgD1G8='
WHERE
key_id = 'e728323f6e37fb397b5050e71ca170ac62f75f06eb214b5c3f4856f123b652c1'
AND (
token = 'tsie1MiI9kHvmTh1+tV8eMZjslIVYZ4CgNWrmcgD1G8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)