UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OXqcreTL/016xzhPlASthqGosszvl8wwXyCvrr8TyKs=' 
WHERE 
  key_id = '03f62b22fa9d79275c4aa3f6e840ca8d508164e53648681525bd927ca2b3fe3c' 
  AND (
    token = 'OXqcreTL/016xzhPlASthqGosszvl8wwXyCvrr8TyKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028