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