UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Kf+xBp2KnPgNSrP8hDL3LqmF1zP0NrWarAA7cp3zaw='
WHERE
key_id = 'd13b549204703b37965a0e886ffea4d52f4232fe548c5f62027e7b85a50f796d'
AND (
token = '3Kf+xBp2KnPgNSrP8hDL3LqmF1zP0NrWarAA7cp3zaw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)