UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IPLzktlLjM01ZI+k38WiZmjm+r4BuVmB8Punu8Ga+DM=' 
WHERE 
  key_id = '572932d9d51b52e57a4887b2acb48d35d0f026dd2c2d1c83e121cfb147490d9c' 
  AND (
    token = 'IPLzktlLjM01ZI+k38WiZmjm+r4BuVmB8Punu8Ga+DM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026