UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ud5hs+oQwTBa+2cd3/jIcEUH4cL2tltXLLYHMmNCTmY='
WHERE
key_id = '9719a62710e8733933d5af59522aff40876a347ebe17bde32b15685f63b2884e'
AND (
token = 'Ud5hs+oQwTBa+2cd3/jIcEUH4cL2tltXLLYHMmNCTmY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)