UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I9Wucgs9jvcHXakOHGDipQ1+983RwPkOOO01CLj+AhI=' 
WHERE 
  key_id = '1266a008f9eb09700d4ef063ec81f16185e568a67f47dedbd8b508cce33cf75f' 
  AND (
    token = 'I9Wucgs9jvcHXakOHGDipQ1+983RwPkOOO01CLj+AhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030