UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+TMkAaQk/zB8k2zulZWLdKbbQycKcgOocyHwec8PaHc=' 
WHERE 
  key_id = '2511b220528b91a526b063a2d7ca4e690cd74833dfddef3dd206686adfb86fe9' 
  AND (
    token = '+TMkAaQk/zB8k2zulZWLdKbbQycKcgOocyHwec8PaHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038