UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CWieYhX0u+UCxGJu7ocUwgT25yoovMAQjPZ1KdDSO+4=' 
WHERE 
  key_id = 'b153c50034ddbac2554635f2c023e35d65fc49bab8e3e8e7a038cefd69e95281' 
  AND (
    token = 'CWieYhX0u+UCxGJu7ocUwgT25yoovMAQjPZ1KdDSO+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048