UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'szE4WzhjMwMe7HUIec7/GX3vhSwkCI+iC4OPeOSHIAs=' 
WHERE 
  key_id = 'ffdf4fcc2b83895cc6724bcfc03dc04dc49edd7832c5082bd37c287efd49205c' 
  AND (
    token = 'szE4WzhjMwMe7HUIec7/GX3vhSwkCI+iC4OPeOSHIAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058