UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HTTIEv3Q05pIUJtuSwkk5VEIvb1h+rXWUPZAmrykZfA='
WHERE
key_id = 'f0a0ee2e106c47ae8e528029a274e29aef753f8021e45e015d300cb90737a7fb'
AND (
token = 'HTTIEv3Q05pIUJtuSwkk5VEIvb1h+rXWUPZAmrykZfA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)