UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1QnEy32oKj5Os+2GuI5pmtBTG4Boc/bZ6Ddrujyip5U=' 
WHERE 
  key_id = 'cfdc3aed4386d06ceab2958b55395f3d710e9e4d5effb205ed17876f1171a843' 
  AND (
    token = '1QnEy32oKj5Os+2GuI5pmtBTG4Boc/bZ6Ddrujyip5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031