UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jKPjpd3sJkpiPKR+BzTPdQcORd8WcTKN0iZPoelbA4o='
WHERE
key_id = 'a73932d4998a8d0d8203efbb8b390d7b2b013f438aed7f1aea81c864caa72627'
AND (
token = 'jKPjpd3sJkpiPKR+BzTPdQcORd8WcTKN0iZPoelbA4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)