UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iyCSdsD//e8dhQC0lGWYpywQhnsIx5Q8WvZD/IpAGhs=' 
WHERE 
  key_id = '0f15c3c9fb8a78b373f244c4f1988709efa2eb61675e37db7595413952cd6931' 
  AND (
    token = 'iyCSdsD//e8dhQC0lGWYpywQhnsIx5Q8WvZD/IpAGhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024