UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6QfzWGf/tw5pBtxr1HSPj1/rvvTgvqnz+1F70njci/U=' 
WHERE 
  key_id = '38d7844bd64812389ab66aea098c91fecc5cf455282db35ce07a130fca8d0733' 
  AND (
    token = '6QfzWGf/tw5pBtxr1HSPj1/rvvTgvqnz+1F70njci/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037