UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h9YoP/55K2qwV2J4lT489ItCEQNm/VXJS+obU4BWbo0=' 
WHERE 
  key_id = '18300a76535f47c3ab5747855a8c656de2ee814bb9da6d1b8223913a92871af4' 
  AND (
    token = 'h9YoP/55K2qwV2J4lT489ItCEQNm/VXJS+obU4BWbo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028