UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HpRWb+zdpcEZAPkRZKy6g64iPQ7ZABAfT3qvUTqdoP0='
WHERE
key_id = '9c5c3138dc909adc4acfa1b2df1b7134420cf0491ca789e285ddcf9e2d9ae4f3'
AND (
token = 'HpRWb+zdpcEZAPkRZKy6g64iPQ7ZABAfT3qvUTqdoP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)