UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n27YRb/W3+5OENGb/PXV2vL1Bfy8Rb84FmAUEafxy4w='
WHERE
key_id = '5677e6ed535327bd434a2d1e2800762d894cf1c18afdc596a3567380d694959d'
AND (
token = 'n27YRb/W3+5OENGb/PXV2vL1Bfy8Rb84FmAUEafxy4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)