UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm/d+C+PRbqutTw10SghURBZBYUyJwet44rLE4mnbUyc=' 
WHERE 
  key_id = '77861cabfafb49e96d3fcb6e7c27d96bd15d23abfe56af3a74189dc554a5b770' 
  AND (
    token = 'm/d+C+PRbqutTw10SghURBZBYUyJwet44rLE4mnbUyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034