UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xhgnGEL+2z1xZSJLqcTyoFXWSa3X/mtxn2nsgfJEpWA=' 
WHERE 
  key_id = '5559dafcd358bd67245a59736fc3921cb3093266c78045e399cf168a55367ab6' 
  AND (
    token = 'xhgnGEL+2z1xZSJLqcTyoFXWSa3X/mtxn2nsgfJEpWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046