UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Q7zUHT22s1bUWQtOOI/AEyFyaaXg+jhNheDW1xzYWs=' 
WHERE 
  key_id = '761c95e9ca9a3b071421b518264faee9d12281e7febffe30538853565054f577' 
  AND (
    token = '1Q7zUHT22s1bUWQtOOI/AEyFyaaXg+jhNheDW1xzYWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049