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