UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JkgtwSkDDUzqFkl42Pc+83CY+Y7F6NKrNUiT1qgMP60='
WHERE
key_id = 'a9c63ca3f621ebdad6fefef99ecb32b14995bdd07c8b17d6d85d4837af35607a'
AND (
token = 'JkgtwSkDDUzqFkl42Pc+83CY+Y7F6NKrNUiT1qgMP60='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)