UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pdVmS+udRiM1iYVLWyS+AVtrKvu0+ie/MVsn+T+e480='
WHERE
key_id = '525d56675704aab71357560dafaa000221a11f8238480a2478a5456ca5484452'
AND (
token = 'pdVmS+udRiM1iYVLWyS+AVtrKvu0+ie/MVsn+T+e480='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)