UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l5xDwBJ803nkyASN3GLMx6tXv1WP45GhBZgseikDDGU=' 
WHERE 
  key_id = '8f85d14f8c301baf33de651a35f30976b56b3c1c13df539f2d022fa0864e7010' 
  AND (
    token = 'l5xDwBJ803nkyASN3GLMx6tXv1WP45GhBZgseikDDGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079