UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W9jobqaZ/zwZk7V5dNTpyw4bQCJVIM06TS3q1SZsXxQ=' 
WHERE 
  key_id = 'a1104462115487168543803255855a39363ca77039fc3edb48ce600d72389002' 
  AND (
    token = 'W9jobqaZ/zwZk7V5dNTpyw4bQCJVIM06TS3q1SZsXxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026