UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9E8kf/exqyq3tteEV2nsb6OpK/dq82adq/YMppPoMF4=' 
WHERE 
  key_id = '7a6fd2e6e8cc006ee9d3e29c47927453357dfde8d2a5932556a64b3f8abce15f' 
  AND (
    token = '9E8kf/exqyq3tteEV2nsb6OpK/dq82adq/YMppPoMF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047