UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H6Ney1X6+jQHIGmeYzkTP0MPoQD4+xlyUVYLuMduT4o='
WHERE
key_id = 'bb4fe031ba0e4d4c56ad8b94e322d81050e632f0c64a8ea1655561aaae6a6f7b'
AND (
token = 'H6Ney1X6+jQHIGmeYzkTP0MPoQD4+xlyUVYLuMduT4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)