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