UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R9hfUMokeiXPd4Gp062IXn4kmqA+a0qZovepDQRtUr8=' 
WHERE 
  key_id = '4888a87da5803e3618e7d05317577b54c171e5d3bceed4e18fbee01921a22de8' 
  AND (
    token = 'R9hfUMokeiXPd4Gp062IXn4kmqA+a0qZovepDQRtUr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021