UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'POGY+cqpd86kjtr87NBH9p8RBr611LaMTNsCjx5Frus=' 
WHERE 
  key_id = 'a579b2b63a97007d0a20d26d10a11f0fbff43dfeab1f9dbbd510faee80ae767e' 
  AND (
    token = 'POGY+cqpd86kjtr87NBH9p8RBr611LaMTNsCjx5Frus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020