UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kM1QR/1FSLiRPTP6CZXt59cuAwgS3wlWUvXLcgH6lAA=' 
WHERE 
  key_id = 'dd89ee884375dc0b46609201224996239036970ebe26ade87f11d8dbe364515b' 
  AND (
    token = 'kM1QR/1FSLiRPTP6CZXt59cuAwgS3wlWUvXLcgH6lAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032