UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lqg5wNJeau9zLUB34u63SmNqL3tHZWnKbbkwy+jpIuU=' 
WHERE 
  key_id = '0f687c3be2f0634cf8c249f161693ddb250b29be9a0a3be37234d6a05bb6dc16' 
  AND (
    token = 'Lqg5wNJeau9zLUB34u63SmNqL3tHZWnKbbkwy+jpIuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017