UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q1t1ICf3VS3bXqyxyFad3N4qS8SQaSaVKgr5BiPVigk=' 
WHERE 
  key_id = '625d232836808d64859834dbd06b38024bb3d4667e2d9e9ca37d31d37792f791' 
  AND (
    token = 'Q1t1ICf3VS3bXqyxyFad3N4qS8SQaSaVKgr5BiPVigk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041